package com.itheima.test.objectstream;

import java.io.Serializable;

//实现Serializable接口的意义:这是一个标记,实现这个接口的对象可被序列化
public class User implements Serializable {//user类
    private static final long SerialVersionUID = 12L;

    private String userName;
    private transient Integer age;//transient标记的成员变量不参与序列化过程


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public User(String userName, Integer age) {
        this.userName = userName;
        this.age = age;
    }

    public User() {
    }

    @Override
    public String toString() {
        return "User{" +
                "userName='" + userName + '\'' +
                ", age=" + age +
                '}';
    }
}
